package com.xtz.controller;

import com.xtz.domain.Category;
import com.xtz.service.AdminCategoryService;
import com.xtz.service.ClienCategoryService;
import com.xtz.vo.CategoryPageVo;
import com.xtz.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * date: 2022/5/4 16:15
 *
 * @author xietianze
 */
@RestController
@RequestMapping("category")
public class CategoryController {
    @Autowired
    private ClienCategoryService clienCategoryService;
    /*@GetMapping("page")
    public Result getCategoryPage(@RequestParam(value = "page",defaultValue = "1")Integer page,
                                  @RequestParam(value = "pageSize",defaultValue = "10")Integer pageSize,
                                  @RequestParam(value = "name")String name){
        List<Category> categoryPage = adminCategoryService.getCategoryPage(page, pageSize);
        Long categoryAmount = adminCategoryService.getCategoryAmount(name);
        CategoryPageVo categoryPageVo = new CategoryPageVo();
        categoryPageVo.setRecords(categoryPage);
        categoryPageVo.setSize(pageSize);
        categoryPageVo.setTotal(categoryAmount);
        categoryPageVo.setCurrent(page);


        return new Result(1,null,categoryPageVo,null);
    }*/

    @GetMapping("list")
    public Result getlist(){
        List<Category> list = clienCategoryService.getlist();
        return new Result(1,null,list,null);
    }

}
